package com.lzy.pattern.iterator.userdefined;

/**
 * @ClassName: Client
 * @Description: TODO
 * @Author: LiuZy
 * @Date: 2022/5/1 19:44
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {
        StudentAggregateImpl aggregate = new StudentAggregateImpl();
        aggregate.add(new Student("木丁西", 28));
        aggregate.add(new Student("刘德华", 48));
        aggregate.add(new Student("木先森", 30));
        aggregate.add(new Student("小龙女", 18));

        StudentIterator iterator = aggregate.getStudentIterator();
        while(iterator.hasNext()){
            Student student = iterator.next();
            System.out.println(student.toString());
        }
    }

}